<template>
  <div class="about">
     <Input v-model="username"  placeholder="请输入用户名" style="width: 300px" />
     <Button type="primary"  @click="login">登陆</Button>
  </div>
</template>
<script>
import {mapActions}  from   'vuex';
    export default {
        data () {
            return {
                username: ''
            }
        },
        methods: {
          ...mapActions(['set_user']),
           login() {
             this['set_user'](this.username).then(data=>{
                this.$router.push('/')
             },error=>{
                 this.$Message.error(error)
             })
          }
        },
    }
</script>
<style>
  .about {
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
  } 
</style>